/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tesis.domain;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author hectdx
 */
@Entity
@Table(name = "conexion")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Conexion.findAll", query = "SELECT c FROM Conexion c"),
    @NamedQuery(name = "Conexion.findByIdconexion", query = "SELECT c FROM Conexion c WHERE c.idconexion = :idconexion")})
public class Conexion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idconexion", nullable = false)
    private Integer idconexion;
    @JoinColumn(name = "idestacionfin", referencedColumnName = "idestacion", nullable = false)
    @ManyToOne(optional = false)
    private Estacion idestacionfin;
    @JoinColumn(name = "idestacioninicio", referencedColumnName = "idestacion", nullable = false)
    @ManyToOne(optional = false)
    private Estacion idestacioninicio;

    public Conexion() {
    }

    public Conexion(Integer idconexion) {
        this.idconexion = idconexion;
    }

    public Integer getIdconexion() {
        return idconexion;
    }

    public void setIdconexion(Integer idconexion) {
        this.idconexion = idconexion;
    }

    public Estacion getIdestacionfin() {
        return idestacionfin;
    }

    public void setIdestacionfin(Estacion idestacionfin) {
        this.idestacionfin = idestacionfin;
    }

    public Estacion getIdestacioninicio() {
        return idestacioninicio;
    }

    public void setIdestacioninicio(Estacion idestacioninicio) {
        this.idestacioninicio = idestacioninicio;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idconexion != null ? idconexion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Conexion)) {
            return false;
        }
        Conexion other = (Conexion) object;
        if ((this.idconexion == null && other.idconexion != null) || (this.idconexion != null && !this.idconexion.equals(other.idconexion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Conexion[ idconexion=" + idconexion + " ]";
    }
    
}
